<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
    <div id="app">
        <!-- <div v-if="flag">1111</div> -->
        <ul  v-if="flag">
            <li v-for="(value,index) in arr" :key=`${index}_a`  >{{value}}</li>
            <img :src="img" alt="">
        </ul>

        <span v-html="msg"></span>
        <div v-once>{{num}}</div>
        <button @click="fn">点我啊</button>
        <!-- <input type="text" :value="value" @input="fn"> -->
        <!-- <input type="text" v-model="value"> 语法糖的写法
        {{value}} -->

        <!--

         把value的值存入v-model绑定的变量中   
        <input type="radio" v-model="radioValue" value="男">男
        <input type="radio" v-model="radioValue" value="女">女
        {{radioValue}} -->

        <!-- 
          单选框 v-model值是true或false  
        <input type="checkbox" v-model="checkValue">打豆豆
         {{checkValue}} -->
            <!-- 多个的话 checkAry是数组,把选中的内容存在这个数组里 -->
         <!-- 
         <input type="checkbox" v-model="checkAry" value="0">吃饭
         <input type="checkbox" v-model="checkAry" value="1">睡觉
         <input type="checkbox" v-model="checkAry" value="2">打豆豆
          {{checkAry}}   -->
          
          <!--若option有value值，则 selectValue 获取value里的值，若没有则获取option里的内容 -->
          <!-- <select v-model="selectValue">
              <option >vue</option>
              <option value="1">react</option>
              <option value="2">吃饭</option>
          </select>
          {{selectValue}} -->
          <select v-model="selectAry" multiple>
                <option>vue</option>
                <option>react</option>
                <option>吃饭</option>
            </select>
            {{selectAry}}

    </div>
</body>
</html>
<script src='vue.js'></script>
<script>
    let vm = new Vue({
         el:"#app",
         data:{ 
           selectAry:[],
           selectValue:"",
           checkAry:[],  
           checkValue:true,   
           radioValue:"男",  
           value:'aaa',
           flag:true,  
           msg:'<em>hello</em>', 
           num:10, 
           arr:['苹果',"香蕉","梨子"],
           img:"http://www.zhufengpeixun.cn/img/pic.png" 
         },
         methods:{
            fn(e){
              // this 指实例
              //this.flag = !this.flag;
              this.value = e.target.value;
            } 
         }    
    })
</script>